home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 14 / CU Amiga Magazine's Super CD-ROM 14 (1997)(EMAP Images)(GB)(Track 1 of 3)[!][issue 1997-09].iso / CUCD / Programming / GMS / Source / Asm / Blitter / ClearWorm.s < prev    next >
Encoding:
Text File  |  1997-05-01  |  4.4 KB  |  239 lines

  1. ;-------T-------T------------------------T----------------------------------;
  2. ;Test routine for ClearBob()
  3. ;---------------------------
  4.  
  5.     INCDIR    "INCLUDES:"
  6.     INCLUDE    "games/games_lib.i"
  7.     INCLUDE    "games/games.i"
  8.  
  9. CALL    MACRO
  10.     jsr    _LVO\1(a6)
  11.     ENDM
  12.  
  13.     SECTION    "ClearBOB",CODE
  14.  
  15. ;===========================================================================;
  16. ;                             INITIALISE DEMO
  17. ;===========================================================================;
  18.  
  19.     STARTGMS
  20.  
  21. Start:    MOVEM.L    A0-A6/D1-D7,-(SP)
  22.     move.l    GMSBase(pc),a6    ;Activate user preferences.
  23.     CALL    AllocBlitter    ;Allocate the blitter.
  24.     tst.l    d0
  25.     bne    .Error_Blitter
  26.  
  27.     CALL    AllocAudio
  28.     tst.l    d0
  29.     bne    .Error_Audio
  30.  
  31.     lea    ScreenTags(pc),a0    ;Initialise the screen.
  32.     CALL    AddScreen
  33.     tst.l    d0
  34.     beq.s    .Error_Screen
  35.  
  36.     move.l    Screen(pc),a0
  37.     lea    PIC_BackgroundTags(pc),a1    ;Load the picture.
  38.     move.l    GS_MemPtr1(a0),PicData
  39.     CALL    LoadPic
  40.     tst.l    d0
  41.     beq.s    .Error_Picture
  42.  
  43.     move.l    PIC_Background(pc),a1
  44.     move.l    PIC_Palette(a1),GS_Palette(a0)
  45.     CALL    UpdatePalette
  46.  
  47.     move.l    Screen(pc),a0    ;Initialise the bob so that it is
  48.     lea    BBT_Rambo(pc),a1    ;ready for drawing.
  49.     CALL    InitBob
  50.     tst.l    d0
  51.     beq.s    .Error_BOB
  52.  
  53.     lea    SMT_Rambo(pc),a0
  54.     CALL    InitSound
  55.     tst.l    d0
  56.     beq.s    .Error_Sound
  57.  
  58.     move.l    Screen(pc),a0
  59.     CALL    ShowScreen
  60.  
  61.     bsr.s    Main
  62.  
  63. .ReturnToDOS
  64.     move.l    GMSBase(pc),a6
  65.     move.l    SND_Rambo(pc),a0
  66.     CALL    FreeSound
  67. .Error_Sound
  68.     move.l    BOB_Rambo(pc),a1
  69.     CALL    FreeBob
  70. .Error_BOB
  71.     move.l    PIC_Background(pc),a1
  72.     CALL    FreePic
  73. .Error_Picture
  74.     move.l    Screen(pc),a0
  75.     CALL    DeleteScreen
  76. .Error_Screen
  77.     CALL    FreeAudio
  78. .Error_Audio
  79.     CALL    FreeBlitter
  80. .Error_Blitter
  81.     MOVEM.L    (SP)+,A0-A6/D1-D7
  82.     moveq    #ERR_OK,d0
  83.     rts
  84.  
  85. ;===========================================================================;
  86. ;                                MAIN LOOP
  87. ;===========================================================================;
  88.  
  89. SPEED    =    5
  90. FIRESPEED =    1
  91.  
  92. Main:    move.l    GMSBase(pc),a6
  93.     CALL    InitJoyPorts
  94.     moveq    #$00,d7
  95.  
  96. .Loop    move.l    Screen(pc),a0
  97.     move.l    BOB_Rambo(pc),a1
  98.     move.w    #BUFFER1,d0
  99.     CALL    ClearBob    ;Blit the bob.
  100.     CALL    WaitVBL    ;Wait for VBL.
  101.     CALL    SwapBuffers
  102.     addq.w    #1,d7
  103.  
  104.     tst.b    FireState
  105.     bne.s    .FireOn
  106.  
  107.     cmp.w    #SPEED,d7
  108.     ble.s    .Move
  109.     moveq    #$00,d7
  110.     addq.w    #1,BOB_Frame(a1)
  111.     cmp.w    #9,BOB_Frame(a1)
  112.     blt.s    .Move
  113.     clr.w    BOB_Frame(a1)
  114.     bra.s    .Move
  115.  
  116. .FireOn    cmp.w    #FIRESPEED,d7
  117.     ble.s    .Move
  118.     moveq    #$00,d7
  119.     cmp.w    #10,BOB_Frame(a1)
  120.     bge.s    .On
  121.     move.w    #9,BOB_Frame(a1)
  122.  
  123. .On    addq.w    #1,BOB_Frame(a1)
  124.     cmp.w    #13,BOB_Frame(a1)
  125.     blt.s    .Move
  126.  
  127.     move.l    SND_Rambo(pc),a0
  128.     CALL    PlaySound
  129.  
  130.     btst    #MB_LMB,d0
  131.     beq.s    .Off
  132.     move.w    #11,BOB_Frame(a1)
  133.     bra.s    .Move
  134.  
  135. .Off    clr.w    BOB_Frame(a1)
  136.     clr.b    FireState
  137.  
  138. .Move    moveq    #JPORT1,d0    ;Read the mouse, then update the
  139.     moveq    #JT_ZBXY,d1    ;BOB's X and Y co-ordinates.
  140.     CALL    ReadJoyPort
  141.     move.w    d0,d1
  142.     ext.w    d0
  143.     add.w    d0,BOB_YPos(a1)
  144.     asr.w    #8,d1
  145.     add.w    d1,BOB_XPos(a1)
  146.  
  147.     btst    #MB_LMB,d0
  148.     beq.s    .chkRMB
  149.     st    FireState    ;Set fire to on.
  150. .chkRMB    btst    #MB_RMB,d0
  151.     beq    .Loop
  152.     rts
  153.  
  154. FireState:
  155.     dc.b    0
  156.     even
  157.  
  158. ;===========================================================================;
  159. ;                                  DATA
  160. ;===========================================================================;
  161.  
  162. ScreenTags:
  163.     dc.l    TAGS_GAMESCREEN
  164. Screen:    dc.l    0
  165.     dc.l    GSA_ScrWidth,320
  166.     dc.l    GSA_ScrHeight,256
  167.     dc.l    GSA_Planes,5
  168.     dc.l    TAGEND
  169.  
  170. PIC_BackgroundTags:
  171.     dc.l    TAGS_PICTURE
  172. PIC_Background:
  173.     dc.l    0
  174.     dc.l    PCA_Data
  175. PicData    dc.l    0
  176.     dc.l    PCA_Width,320
  177.     dc.l    PCA_Height,256
  178.     dc.l    PCA_Planes,5
  179.     dc.l    PCA_Options,GETPALETTE
  180.     dc.l    PCA_File,.file
  181.     dc.l    TAGEND
  182. .file    dc.b    "GMS:demos/data/PIC.Green",0
  183.     even
  184.  
  185. BBT_Rambo:
  186.     dc.l    TAGS_BOB
  187. BOB_Rambo:
  188.     dc.l    0
  189.     dc.l    BBA_Framelist,.frames
  190.     dc.l    BBA_Width,32
  191.     dc.l    BBA_ByteWidth,32/8
  192.     dc.l    BBA_Height,24
  193.     dc.l    BBA_XCoord,66
  194.     dc.l    BBA_YCoord,66
  195.     dc.l    BBA_ClipLX,32
  196.     dc.l    BBA_ClipRX,320-32
  197.     dc.l    BBA_ClipTY,32
  198.     dc.l    BBA_ClipBY,256-32
  199.     dc.l    BBA_Attrib,CLRMASK|GENMASKS|CLIP
  200.     dc.l    BBA_PictureTags,.picture
  201.     dc.l    TAGEND
  202. .picture
  203.     dc.l    TAGS_PICTURE,0
  204.     dc.l    PCA_Planes,5
  205.     dc.l    PCA_Options,BLITMEM
  206.     dc.l    PCA_FILE,.file
  207.     dc.l    TAGEND
  208. .file    dc.b    "GMS:demos/data/PIC.Rambo",0
  209.     even
  210.  
  211. .frames    dc.w    000,00,0,0    ;0 X/Y Graphic, X/Y Mask
  212.     dc.w    032,00,0,0    ;1 ...
  213.     dc.w    064,00,0,0    ;2
  214.     dc.w    096,00,0,0    ;3
  215.     dc.w    128,00,0,0    ;4
  216.     dc.w    160,00,0,0    ;5
  217.     dc.w    192,00,0,0    ;6
  218.     dc.w    224,00,0,0    ;7
  219.     dc.w    256,00,0,0    ;8
  220.     dc.w    288,00,0,0    ;9
  221.     dc.w    000,48,0,0    ;10
  222.     dc.w    032,48,0,0    ;11
  223.     dc.w    064,48,0,0    ;12
  224.     dc.l    -1
  225.  
  226.  
  227. SMT_Rambo:
  228.     dc.l    TAGS_SOUND
  229. SND_Rambo:
  230.     dc.l    0
  231.     dc.l    SA_Channel,CHANNEL1
  232.     dc.l    SA_Octave,OCT_C2S
  233.     dc.l    SA_Volume,100
  234.     dc.l    SA_File,.file
  235.     dc.l    TAGEND
  236. .file    dc.b    "GMS:demos/data/SND.Rambo",0
  237.     even
  238.  
  239.